home *** CD-ROM | disk | FTP | other *** search
/ Gold Medal Software 3 / Gold Medal Software - Volume 3 (Gold Medal) (1994).iso / graphics / 3dvect30.arj / ARGC.ASM < prev    next >
Assembly Source File  |  1993-11-18  |  5KB  |  212 lines

  1. ; this code belongs to TRAN
  2.  
  3. ; CCHEKSWITCH           = 1
  4. ; CCHEKSTR              = 1
  5. ; CCHEKSSTR             = 1
  6.         .386p
  7.         jumps
  8. code32  segment para public use32
  9.         assume cs:code32, ds:code32, ss:code32
  10.  
  11. include pmode.inc
  12. include macros.inc
  13.  
  14. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  15. ; CODE
  16. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  17.  
  18. ;─────────────────────────────────────────────────────────────────────────────
  19. setandchek:                             ; Set up ES, EDI, ECX and chek length
  20.         mov bx,18h
  21.         mov es,bx
  22.         mov edi,_code16a
  23.         sub edi,7fh
  24.         movzx ecx,byte ptr es:[edi-1]
  25.         cmp cl,ah
  26.         jb setandchekf
  27.         ret
  28. setandchekf:                            ;  command line too short
  29.         pop eax
  30.         pop es
  31.         popad
  32.         stc
  33.         ret
  34.  
  35. ;─────────────────────────────────────────────────────────────────────────────
  36. findswitch:                             ; Find switch AL on command line
  37.         mov ah,al
  38.         mov ebx,edi
  39.         mov ebp,ecx
  40. findswitchl1:
  41.         mov al,'/'
  42.         repnz scasb
  43.         jecxz findswitch2
  44.         mov al,ah
  45.         dec ecx
  46.         scasb
  47.         jne findswitchl1
  48.         ret
  49. findswitch2:
  50.         mov edi,ebx
  51.         mov ecx,ebp
  52. findswitchl2:
  53.         mov al,'-'
  54.         repnz scasb
  55.         jecxz setandchekf
  56.         mov al,ah
  57.         dec ecx
  58.         scasb
  59.         jne findswitchl2
  60.         ret
  61.  
  62. ifdef   CCHEKSWITCH
  63. public  _cchekswitch
  64. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  65. ; Chek if switch AL entered on command line
  66. ; In:
  67. ;   AL - switch
  68. ; Out:
  69. ;   CF=1 - switch does not exist
  70. ;   CF=0 - switch exists on command line
  71. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  72. _cchekswitchnc:
  73.         cmp al,'A'
  74.         jb short _cchekswitch
  75.         cmp al,'z'
  76.         ja short _cchekswitch
  77.         cmp al,'a'
  78.         jae short cchekswitchncf0
  79.         cmp al,'Z'
  80.         ja short _cchekswitch
  81. cchekswitchncf0:
  82.         push ax
  83.         and al,0dfh
  84.         call _cchekswitch
  85.         pop ax
  86.         jnc _ret
  87.         push ax
  88.         or al,20h
  89.         call _cchekswitch
  90.         pop ax
  91.         ret
  92. _cchekswitch:
  93.         pushad
  94.         push es
  95.         mov ah,3
  96.         call setandchek
  97.         call findswitch
  98.         pop es
  99.         popad
  100.         clc
  101.         ret
  102. endif
  103.  
  104. ifdef   CCHEKSTR
  105. public  _cchekstr
  106. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  107. ; Get string number AL
  108. ; In:
  109. ;   AL - string number
  110. ;   EDX -> buffer for string
  111. ; Out:
  112. ;   CF=1 - string not found
  113. ;   CF=0 - string found
  114. ;     EDX - ASCIIZ string
  115. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  116. _cchekstr:
  117.         pushad
  118.         push es
  119.         mov ah,2
  120.         call setandchek
  121.         inc al
  122.         mov bl,al
  123. chekstrl1:
  124.         mov al,' '
  125.         repnz scasb
  126.         jecxz chekstrf
  127.         mov al,es:[edi]
  128.         cmp al,'-'
  129.         je chekstrl1
  130.         cmp al,'/'
  131.         je chekstrl1
  132.         dec bl
  133.         jnz chekstrl1
  134.         push ds
  135.         mov ax,es
  136.         mov bx,ds
  137.         mov es,bx
  138.         mov ds,ax
  139.         mov esi,edi
  140.         mov edi,edx
  141. chekstrl2:
  142.         lodsb
  143.         stosb
  144.         cmp al,' '
  145.         loopnz chekstrl2
  146.         jnz chekstrf1
  147.         dec edi
  148. chekstrf1:
  149.         xor al,al
  150.         stosb
  151.         pop ds
  152.         pop es
  153.         popad
  154.         clc
  155.         ret
  156. chekstrf:
  157.         pop es
  158.         popad
  159.         stc
  160.         ret
  161. endif
  162.  
  163. ifdef   CCHEKSSTR
  164. public  _ccheksstr
  165. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  166. ; Get string associated with switch AL
  167. ; In:
  168. ;   AL - switch
  169. ;   EDX -> buffer for string
  170. ; Out:
  171. ;   CF=1 - string not found
  172. ;   CF=0 - string found or switch does not have string
  173. ;     EDX - ASCIIZ string
  174. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  175. _ccheksstr:
  176.         pushad
  177.         push es
  178.         mov ah,4
  179.         call setandchek
  180.         call findswitch
  181.         jecxz chekstrf
  182.         cmp byte ptr es:[edi],' '
  183.         je chekstrf
  184.         push ds
  185.         mov ax,es
  186.         mov bx,ds
  187.         mov es,bx
  188.         mov ds,ax
  189.         mov esi,edi
  190.         mov edi,edx
  191. cheksstrl2:
  192.         lodsb
  193.         stosb
  194.         cmp al,' '
  195.         loopnz cheksstrl2
  196.         jnz cheksstrf1
  197.         dec edi
  198. cheksstrf1:
  199.         xor al,al
  200.         stosb
  201.         pop ds
  202.         pop es
  203.         popad
  204.         clc
  205.         ret
  206. endif
  207.  
  208.  
  209. code32  ends
  210.         end
  211.  
  212.